package com.heima.kafka.boot.listener;

import com.alibaba.fastjson.JSON;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 消费者监听类
 */
@Component
public class ConsumerListener {
    /**
     * 监听方法
     */
    @KafkaListener(topics ={"kafka-stream-consumer"})
    public void getMessage(ConsumerRecord consumerRecord) {
        System.out.println("消息的key："+consumerRecord.key()+"消息的value："+consumerRecord.value());
    }
}
